package com.zjht.gmcc.servlet.sys;

/* 
 * @author wxj
 * @version 1.4
 * ���ܣ���֯ɾ��
 * 2006-12-27
 */
import java.io.PrintWriter;
import java.sql.PreparedStatement;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zjht.gmcc.bean.BaseServlet;
import com.zjht.gmcc.bean.util.InitParam;
import com.zjht.gmcc.bean.util.MyJDBC;

public class OrgaDel extends BaseServlet {

	private static final long serialVersionUID = 2999687323798201136L;

	public boolean process(HttpServletRequest request, HttpServletResponse response, HttpSession session, PrintWriter out, MyJDBC myJDBC, String menu)
			throws Exception {
		int i_flag = 0;

		String s_orgacode = request.getParameter("orgacode");

		String s_destination_cg = "/sys/orga/orga.jsp";
		String s_destination_cg1 = "/sys/orga/opers.jsp?";
		String url = "/sys/orga/orga.jsp?orgacode=" + s_orgacode;

		String s_sql = null;
		PreparedStatement ps = null;

		s_sql = "delete from organiza where orgacode = ?";
		ps = myJDBC.prepareStatement(s_sql);
		ps.setString(1, s_orgacode);

		i_flag = ps.executeUpdate();
		s_sql = null;
		ps.close();
		ps = null;

		String act = s_orgacode + "删除";
		if (i_flag > 0) {
			InitParam.initOrgaInfo();
			alert(out, act + "成功", "parent.orgamainFrame.location.href='" + s_destination_cg1
					+ "';parent.orgaleftFrame.location.reload();window.location.href='" + s_destination_cg + "';");
		} else {
			alert(out, act + "失败", url);
		}
		return i_flag > 0;
	}
}
